package com.timguan.render.api.entity.cms;

import net.pocrd.annotation.Description;

import java.io.Serializable;
import java.util.List;

@Description("页面配置")
public class CMSPageConfig implements Serializable {
    @Description("背景色,宽度默认(整楼层)")
    public String backgroundColor;
    @Description("背景图片")
    public String backgroundUrl;
    @Description("风向图标")
    public String shareIcon;
    @Description("页面的布局配置")
    public List<PageLayoutConfig> pageLayoutConfigs;

    /**
     * 获取page layout
     *
     * @return
     */
    public List<PageLayoutConfig> getPageLayoutConfigs() {
        return pageLayoutConfigs;
    }

    public void setPageLayoutConfigs(List<PageLayoutConfig> pageLayoutConfigs) {
        this.pageLayoutConfigs = pageLayoutConfigs;
    }

    public String getBackgroundColor() {
        return backgroundColor;
    }

    public void setBackgroundColor(String backgroundColor) {
        this.backgroundColor = backgroundColor;
    }

    public String getBackgroundUrl() {
        return backgroundUrl;
    }

    public void setBackgroundUrl(String backgroundUrl) {
        this.backgroundUrl = backgroundUrl;
    }

    public String getShareIcon() {
        return shareIcon;
    }

    public void setShareIcon(String shareIcon) {
        this.shareIcon = shareIcon;
    }

    @Override
    public String toString() {
        return "CMSPageConfig{" +
                "backgroundColor='" + backgroundColor + '\'' +
                ", backgroundUrl='" + backgroundUrl + '\'' +
                ", shareIcon='" + shareIcon + '\'' +
                ", pageLayoutConfigs=" + pageLayoutConfigs +
                '}';
    }

    @Description("页面布局配置")
    public static class PageLayoutConfig implements Serializable {
        @Description("布局在页面中的编号(唯一编号)")
        public int idInPage;
        @Description("布局编号")
        public int layoutId;
        @Description("布局中模块配置")
        public List<LayoutModuleConfig> layoutModuleConfigs;

        public int getLayoutId() {
            return layoutId;
        }

        public void setLayoutId(int layoutId) {
            this.layoutId = layoutId;
        }

        public int getIdInPage() {
            return idInPage;
        }

        public void setIdInPage(int idInPage) {
            this.idInPage = idInPage;
        }

        public List<LayoutModuleConfig> getLayoutModuleConfigs() {
            return layoutModuleConfigs;
        }

        public void setLayoutModuleConfigs(List<LayoutModuleConfig> layoutModuleConfigs) {
            this.layoutModuleConfigs = layoutModuleConfigs;
        }

        @Override
        public String toString() {
            return "PageLayoutConfig{" +
                    "idInPage=" + idInPage +
                    ", layoutId=" + layoutId +
                    ", layoutModuleConfigs=" + layoutModuleConfigs +
                    '}';
        }
    }

    /**
     * 布局内module配置
     */
    @Description("布局内模块配置")
    public static class LayoutModuleConfig implements Serializable {
        @Description("模块在布局内的编号(布局内的唯一编号)")
        public int idInLayout;
        @Description("模块实例名称,${moduleName}_${idInPage}_${idInModule}")
        public String placeHolder;
        @Description("模块名称")
        public String moduleName;
        //模板定义，vm片段
        private transient String moduleDefinition;
        @Description("模块描述")
        public String description;
        @Description("短描述")
        public String shortDescription;
        @Description("模块的标题")
        public String moduleTitle;
        @Description("模块的子标题")
        public String moduleSubTitle;
        @Description("模块LOGO")
        public String moduleLogo;
        @Description("右侧链接")
        public String rightLink;
        @Description("模块标题类型")
        public MData.HeadType headType;
        @Description("模块样式")
        public Style style;
        @Description("模块中子模块的配置")
        public List<ModuleSubModuleConfig> moduleSubModuleConfigs;
        @Description("模块缩略图")
        public String picUrl;
        @Description("特殊说明")
        public String specialContent;
        //模块分组，用来做模块轮播
        public String bucket;
        public boolean canSlide;
        //轮播间隔时间
        public long slideTime;

        public String getSpecialContent() {
            return specialContent;
        }

        public void setSpecialContent(String specialContent) {
            this.specialContent = specialContent;
        }

        public String getShortDescription() {
            return shortDescription;
        }

        public void setShortDescription(String shortDescription) {
            this.shortDescription = shortDescription;
        }

        private transient int index;

        public String getBucket() {
            return bucket;
        }

        public void setBucket(String bucket) {
            this.bucket = bucket;
        }

        public boolean isCanSlide() {
            return canSlide;
        }

        public void setCanSlide(boolean canSlide) {
            this.canSlide = canSlide;
        }

        public long getSlideTime() {
            return slideTime;
        }

        public void setSlideTime(long slideTime) {
            this.slideTime = slideTime;
        }

        public String getPicUrl() {
            return picUrl;
        }

        public void setPicUrl(String picUrl) {
            this.picUrl = picUrl;
        }

        public int getIndex() {
            return index;
        }

        public void setIndex(int index) {
            this.index = index;
        }

        public int getIdInLayout() {
            return idInLayout;
        }

        public void setIdInLayout(int idInLayout) {
            this.idInLayout = idInLayout;
        }

        public String getPlaceHolder() {
            return placeHolder;
        }

        public void setPlaceHolder(String placeHolder) {
            this.placeHolder = placeHolder;
        }

        public String getModuleName() {
            return moduleName;
        }

        public void setModuleName(String moduleName) {
            this.moduleName = moduleName;
        }

        public String getModuleDefinition() {
            return moduleDefinition;
        }

        public void setModuleDefinition(String moduleDefinition) {
            this.moduleDefinition = moduleDefinition;
        }

        public String getDescription() {
            return description;
        }

        public void setDescription(String description) {
            this.description = description;
        }

        public List<ModuleSubModuleConfig> getModuleSubModuleConfigs() {
            return moduleSubModuleConfigs;
        }

        public void setModuleSubModuleConfigs(List<ModuleSubModuleConfig> moduleSubModuleConfigs) {
            this.moduleSubModuleConfigs = moduleSubModuleConfigs;
        }

        public String getModuleTitle() {
            return moduleTitle;
        }

        public void setModuleTitle(String moduleTitle) {
            this.moduleTitle = moduleTitle;
        }

        public String getModuleSubTitle() {
            return moduleSubTitle;
        }

        public void setModuleSubTitle(String moduleSubTitle) {
            this.moduleSubTitle = moduleSubTitle;
        }

        public String getRightLink() {
            return rightLink;
        }

        public void setRightLink(String rightLink) {
            this.rightLink = rightLink;
        }

        public MData.HeadType getHeadType() {
            return headType;
        }

        public void setHeadType(MData.HeadType headType) {
            this.headType = headType;
        }

        public Style getStyle() {
            return style;
        }

        public void setStyle(Style style) {
            this.style = style;
        }

        public String getModuleLogo() {
            return moduleLogo;
        }

        public void setModuleLogo(String moduleLogo) {
            this.moduleLogo = moduleLogo;
        }

        @Override
        public String toString() {
            return "LayoutModuleConfig{" +
                    "idInLayout=" + idInLayout +
                    ", placeHolder='" + placeHolder + '\'' +
                    ", moduleName='" + moduleName + '\'' +
                    ", moduleDefinition='" + moduleDefinition + '\'' +
                    ", description='" + description + '\'' +
                    ", shortDescription='" + shortDescription + '\'' +
                    ", moduleTitle='" + moduleTitle + '\'' +
                    ", moduleSubTitle='" + moduleSubTitle + '\'' +
                    ", moduleLogo='" + moduleLogo + '\'' +
                    ", rightLink='" + rightLink + '\'' +
                    ", headType=" + headType +
                    ", style=" + style +
                    ", moduleSubModuleConfigs=" + moduleSubModuleConfigs +
                    ", picUrl='" + picUrl + '\'' +
                    ", specialContent='" + specialContent + '\'' +
                    ", bucket='" + bucket + '\'' +
                    ", canSlide=" + canSlide +
                    ", slideTime=" + slideTime +
                    ", index=" + index +
                    '}';
        }
    }

    /**
     * 子模块绑定processor以及入参（存在没有入参的情况或者processor的入参在binding记录创建的时候才指定）
     */
    @Description("模块内子模块的配置")
    public static class ModuleSubModuleConfig implements Serializable {
        @Description("子模块的编号")
        public int subModuleId;
        @Description("处理器名称")
        public String processorBeanName;
        @Description("处理器的参数以及值,json格式")
        public String processorParameters;

        public int getSubModuleId() {
            return subModuleId;
        }

        public void setSubModuleId(int subModuleId) {
            this.subModuleId = subModuleId;
        }

        public String getProcessorBeanName() {
            return processorBeanName;
        }

        public void setProcessorBeanName(String processorBeanName) {
            this.processorBeanName = processorBeanName;
        }

        public String getProcessorParameters() {
            return processorParameters;
        }

        public void setProcessorParameters(String processorParameters) {
            this.processorParameters = processorParameters;
        }

        @Override
        public String toString() {
            return "ModuleSubModuleConfig{" +
                    "subModuleId=" + subModuleId +
                    ", processorBeanName='" + processorBeanName +
                    ", processorParameters=" + processorParameters +
                    '}';
        }
    }
}
